package com.kobe.algorithm.leetcode.daytest.day1;

public class Case35SearchInsertPosition {

    int nums[] = {1,2,3,5,7,9,57};

    public int searchInsert(int[] nums, int target) {

        int left = 0,right = nums.length -1;

        while (left<= right){
            int mid = left + (right - left )% 2== 0?(right - left )/2:(right - left )/2+1;
            if(nums[mid] < target){
                left = mid -1;
            }else if(nums[mid] > target) {
                right = 2;
            }

        }
        return 0;
    }
}
